home *** CD-ROM | disk | FTP | other *** search
/ PC Action 1997 January / PCA0197.ISO / demos / ambe / demo.exe / demo.dxr / 00007_CDletter() handler, finds CD drive-letter with Lingo...ls < prev    next >
Encoding:
Text File  |  1996-10-18  |  929 b   |  32 lines

  1. on GetCDletter tagFile, discNumber
  2.   set fileObject to new(xtra("fileio"))
  3.   if not objectp(fileObject) then
  4.     return #fileioNotCreated
  5.   end if
  6.   repeat with i = 67 to 90
  7.     set drive to numToChar(i)
  8.     set myThisPath to string(drive & ":\hidingPlace\" & tagFile & discNumber)
  9.     openFile(fileObject, myThisPath, 1)
  10.     set statusMsg to error(fileObject, status(fileObject))
  11.     if statusMsg = "OK" then
  12.       closefile(fileObject)
  13.       set fileObject to 0
  14.       return drive & ":"
  15.       exit
  16.     end if
  17.   end repeat
  18.   repeat with i = 65 to 66
  19.     set drive to numToChar(i)
  20.     set myThisPath to string(drive & ":\hidingPlace\" & tagFile & discNumber)
  21.     openFile(fileObject, myThisPath, 0)
  22.     set statusMsg to error(fileObject, status(fileObject))
  23.     if statusMsg = "OK" then
  24.       closefile(fileObject)
  25.       set fileObject to 0
  26.       return drive & ":"
  27.       exit
  28.     end if
  29.   end repeat
  30.   return #driveNotFound
  31. end
  32.